<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/includes/common-import.jsp"%>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
	<meta charset="utf-8" />
	<title>后台管理系统</title>
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<%@ include file="/WEB-INF/includes/common-component-edit.jsp"%>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
	<!-- BEGIN HEADER -->
	<%@ include file="/WEB-INF/includes/header.jsp"%>
	<!-- END HEADER -->
	<!-- BEGIN CONTAINER -->
	<div class="page-container row-fluid">
		<!-- BEGIN SIDEBAR -->
		<%@ include file="/WEB-INF/includes/leftMenu.jsp"%>
		<!-- END SIDEBAR -->
		<div class="page-content">
			<!-- BEGIN PAGE CONTAINER-->        
			<div class="container-fluid">
				<!-- BEGIN PAGE HEADER-->
				<div class="row-fluid">
					<div class="span12">
						<h3 class="page-title">
							系统菜单管理
							 <small>新增菜单</small>
						</h3>
						<!-- END PAGE TITLE & BREADCRUMB-->
					</div>
				</div>
				<!-- END PAGE HEADER-->
				<!-- BEGIN PAGE CONTENT-->
				<div class="row-fluid">

					<div class="span12">

						<div class="portlet box blue" id="form_wizard_1">
							<div class="portlet-title">
								<div class="caption">
									<i class="icon-reorder"></i> 菜单基本信息
								</div>
							</div>

							<div class="portlet-body form">

								<form id="inputForm" class="form-horizontal" action="${basePath}system/menu/${action}" method="post" >
									<input type="hidden" name="id" value="${menu.id }"/>
									<div class="alert alert-error ${empty MESSAGE ?'hide':'' }">
										<button class="close" data-dismiss="alert"></button>
										<span>${MESSAGE }</span>
									</div>
									
									<div class="control-group">
										<label class="control-label">
											菜单名称<span class="required">*</span>
										</label>
										<div class="controls">
											<input name="menuName" class="span6 m-wrap required" type="text" 
												placeholder="30位字符以内有效..." value="${menu.menuName}">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">
											菜单图标<span class="required">*</span>
										</label>
										<div class="controls">
											<input name="icon" class="span6 m-wrap" type="text" 
												placeholder="添加菜单图标样式..." value="${menu.icon}">
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">
											连接地址
										</label>
										<div class="controls">
											<input name="menuLink" class="span6 m-wrap" type="text" maxlength="100"
												placeholder="100位字符以内有效..." value="${menu.menuLink}">
											<span class="help-inline">功能菜单访问路径</span>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">
											上级菜单
										</label>
										<div class="controls">
											<input name="pNames" class="span6 m-wrap" type="text" value="${menu.pNames}" readonly="readonly">
											<input name="pId" class="span6 m-wrap" type="hidden" value="${menu.pId}">
											<a id="selMenuTree" class="btn" href="#">选择</a>
										</div>
									</div>

									<div class="control-group">
										<label class="control-label">
											功能说明
										</label>
										<div class="controls">
											<textarea name="remark" class="span6 m-wrap" rows="3">${menu.remark}</textarea>
											<span class="help-inline">功能菜单备注说明信息</span>
										</div>
									</div>
									
									<div class="form-actions clearfix">
										
										<button class="btn blue" type="submit"><i class="icon-ok"></i>完成</button>
										&nbsp;&nbsp;
										<a class="btn" onclick="cancle();">取消</a>
			
									</div>
								</form>
							</div>

						</div>

					</div>

				</div>
			</div>
			<!-- END PAGE CONTAINER-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<div class="footer">
		<div class="footer-inner">
			2013 &copy; Metronic by keenthemes.
		</div>
		<div class="footer-tools">
			<span class="go-top">
			<i class="icon-angle-up"></i>
			</span>
		</div>
	</div>
	<!-- END FOOTER -->
	
	<script src="${resPath}media/js/app.js"></script>   
	<script>
		
		jQuery(document).ready(function() { 		   
		   $("#inputForm").validate();
		   App.init();
		   $("#selMenuTree").click(function(){
			   var urlParam = "${basePath}system/menu/select?type=radiobox&checkedItems="+$("#pId").val();
			    $.dialog({
					id: 'popOrg',
				    content: 'url:' + urlParam + '&d='+new Date(),
				    title:'功能菜单选择',
				    width: '590px',
				    height: 500,
				    ok: function(){
				    	var json = eval(this.content.returnJsonFunc());
				    	if(json == null){
				    		$("#pId").val("");
					    	$("#pNames").val("");
					    	checkedItems = "";
				    	}else{
				    		$("#pId").val(json.data);
					    	$("#pNames").val(json.txt);
					    	checkedItems = json.data;
				    	}
				        return true;
				    },
				    cancelVal: '关闭'
				});
		   });
		});
		function cancle(){
			window.location = "${basePath}system/menu";
		}
	</script>
</body>
<!-- END BODY -->
</html>